package com.meituan.verintreport.config;

import com.alibaba.druid.pool.DruidDataSource;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.boot.jdbc.DataSourceBuilder;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Primary;
import org.springframework.context.annotation.PropertySource;

import javax.sql.DataSource;

@Configuration
//@PropertySource("classpath:config.properties")
public class DataSourceConfig {

    @Bean("verintDataSource")
    @ConfigurationProperties(prefix = "verint.database")
    public DataSource VerintDataSource() {
//        return DataSourceBuilder.create().build();
        DruidDataSource dataSource = new DruidDataSource();
        return dataSource;
    }

    @Primary
    @Bean("reportDataSource")
    @ConfigurationProperties(prefix = "report.database")
    public DataSource ReportDataSource() {
//        return DataSourceBuilder.create().build();
        DruidDataSource dataSource = new DruidDataSource();
        return dataSource;
    }
}
